<%--
  Created by IntelliJ IDEA.
  User: user
  Date: 2021/5/12
  Time: 14:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    //获取项目的根路径
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <title>找回密码</title>
    <script src="<%=basePath%>layui-v2.6.6/layui/layui.js"></script>
    <link rel="stylesheet" href="<%=basePath%>layui-v2.6.6/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>sweetalert.css">
    <script type="text/javascript" src="<%=basePath%>sweetalert-dev.js"></script>
    <style type="text/css">
        body{
            background-color: #d8bfd8;
        }
        #kuang1{
            width: 450px;
            height: 550px;
            border: 0px #ffffff solid;
            margin:auto;
            text-align:center;
            margin-top: 70px;
            background-color: rgba(17, 16, 16, 0.5);

        }
        #biao{
            width: 330px;
            height: 320px;
            background-color: #FFFFFF;
            margin:auto;
            border-radius:20px 20px 20px 20px;
            background-color: rgba(246, 244, 244, 0.4);
            padding-top: 46px;
            padding-right: 26px;
        }
        *{
            margin: 0px;
        }
        #zhaohui{
            margin-top: 25px;
            margin-bottom: 30px;
            color: #FFFFFF;
        }
        #shoulan{
            width: 100%;
            height: 55px;
            border: 0px #FFFFFF solid;
            background-color: rgba(17, 16, 16, 0.7);
        }
        #shoulan a{
            color: #FFFFFF;
            font-size: 20px;
            float: right;
            margin-top: -30px;
            padding-right: 200px;
            text-decoration: none;
        }
        #shoulan a:hover{
            color: #eece2a;
        }
        .huazi{
            color: #b1a9a9;
            font-size: 23px;
            padding-top: 12px;
            padding-left: 140px;
        }
        input[type="text"], input[type="password"], input[type="email"] {
            width: 300px;
            padding: 16px 10px 15px 60px;
            font-size: 14px;
            background: transparent;
            border: none;
            border: 2px solid #ffffff;
            outline: none;
            margin-bottom: 26px;
            color: #fff;
            border-radius:25px;
        'Quicksand', sans-serif;
            float: right;
        }
        ::-webkit-input-placeholder{
            color: #F0F0F0;
            font-size: 14px;
            line-height: 50px;
        }
        .anniu{
            padding-top: 340px;
        }

    </style>
</head>

<body background="../library/img/beijin.jpg" style=" background-repeat:no-repeat ;background-size:100% 100%;
background-attachment: fixed;">
        <div id="shoulan">
            <div class="huazi">
                华子图书馆！
            </div>
            <a href="<%=basePath%>/library/logins.jsp">登录</a>
        </div>
        <div id="kuang1">
            <h1 id="zhaohui">找回密码</h1>
            <div id="biao">
                <form action="<%=basePath%>ReaderLogin?tp=updatePwd" method="post">
                    <input type="text" name="phone" id="input1"  placeholder="请输入手机号" required>
                    <input type="text" name="sfz" id="sfz"  placeholder="请输入身份证" required>
                    <input type="Password" name="pwd" id="input3"  placeholder="请输入新密码" required>
                    <input type="Password" name="pwd2" id="input4"  placeholder="请确认新密码" required>
                    <div class="anniu">
                        <input type="submit" style="width:357px;height:50px; background-color: #FF5722; color: #FFFFFF;border: 1px #FF5722 solid" class="layui-btn layui-btn-primary layui-btn-radius" value="确定">
                    </div>
                </form>

            </div>
        </div>

</body>
<script type="text/javascript" src="<%=basePath%>/jquery-1.12.4.js"></script>
<script type="text/javascript">
    $(function () {
        $("#input4").blur(function () {
            let val2 =$("#input3").val();
            let val3 =$("#input4").val();
            if(val3!=val2){
                swal("密码不一致");
            }
        })
            $("#sfz").blur(function () {
                let phone=$("#input1").val();
                let sfz=$("#sfz").val();
                $.ajax(
                    {
                        url:"<%=basePath%>ReaderLogin",
                        data:{
                            phone:phone,
                            sfz:sfz,
                            tp:"selectSfz"
                        },
                        type:"post",
                        dataType:"json",
                        success:function (data) {
                            if (data){
                             
                            }else {
                                swal("没有该用户");
                            }
                        }
                    });
            })

        })

        $(".anniuzi").click(function () {
            let val = $("#input1").val();
            let val1 = $("#input2").val();
            let val2 =$("#input3").val();
            let val3 =$("#input4").val();
            if(val.toString().trim().length==0){
                swal({
                    title: "手机号码不能为空"
                })
            }else if(val1.toString().trim().length==0){
                swal({
                    title: "身份证不能为空"
                })
            }else if(val2.toString().trim().length==0){
                swal({
                    title: "密码不能为空"
                })
            }else if(val3.toString().trim().length==0){
                swal({
                    title: "密码不能为空"
                })
            }

        })
</script>
</html>
